import React, { Component } from 'react';
import { Form, Input } from 'antd';

const Item = Form.Item;

const layout = {
  labelCol: {
    sm: 5,
  },
  wrapperCol: {
    sm: 17,
  }
};

export default class FormItem extends Component {
  render() {
    const { getFieldDecorator, children, label, id, required = true, rules } = this.props;
    return (
      <Item label={label} {...layout}>
        {getFieldDecorator(id, {
          rules,
        })(children || <Input />)}
      </Item>
    );
  }
}
